home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / NeoIntroTCL3.0 folder / TCL / NeoDemo / Includes / CNeoScrapStream.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-31  |  3.5 KB  |  88 lines  |  [TEXT/KAHL]

  1.  /************************************************************
  2.  *
  3.  *    Created: Wednesday, November 24, 1993 19:25:00
  4.  *
  5.  *    CNeoScrapStream.h
  6.  *
  7.  *    C++ class implementation for a scrap stream class
  8.  *
  9.  *    Most C++ compilers include a standard set of classes which
  10.  *    implement an input/output facility which is referred to as
  11.  *    a stream. The most common stream class supports the
  12.  *    transfer of basic C data types such as integers, floating-
  13.  *    point numbers and character strings to and from a file.
  14.  *
  15.  *    While streams have been around for some time, our
  16.  *    understanding of them continues to evolve. We know, for
  17.  *    example, that we need different types of streams for
  18.  *    different purposes. Application-specific environments may
  19.  *    benefit from the use of a stream subclass which also
  20.  *    supports application-specific data types, an imaginary
  21.  *    number for instance. Other environments may find useful a
  22.  *    stream that transfers data not to a file but across a
  23.  *    network pipe or an interprocess communications channel. As
  24.  *    you can see from these two examples, there are two
  25.  *    directions in which stream derivations can occur. One
  26.  *    direction addresses the type of data being accessed. The
  27.  *    other defines the source/destination of the data.
  28.  *
  29.  *    NeoAccess  releases 2.2 and later use a construct called a
  30.  *    stream to address the issue of where data is coming from or
  31.  *    going to. The abstract base class CNeoStream provides an
  32.  *    interface through which basic data types can be read in or
  33.  *    written out. This base class is subclassed to build a stream
  34.  *    class, CNeoFileStream, for reading from and writing to a
  35.  *    file.
  36.  *
  37.  *    The NeoAccess database class, CNeoDatabase, provides an
  38.  *    extremely powerful mechanism for accessing persistent objects.
  39.  *    These objects use persistence properties provided by their 
  40.  *    base class, CNeoPersist. And together these three base
  41.  *    classes - CNeoStream, CNeoDatabase and CNeoPersist - create an
  42.  *    incredibly powerful and high performance database engine which
  43.  *    is both extensible and easy to use.
  44.  *
  45.  *    Copyright © Neologic Systems 1992-1994. All Rights Reserved.
  46.  *    All rights reserved
  47.  *
  48.  *
  49.  ***********************************************************/
  50. #pragma once            /* Include this file only once */
  51. #ifndef __CNeoScrapStream__
  52. #define __CNeoScrapStream__ 1
  53.  
  54. #include "NeoTypes.h"
  55.  
  56. #include CNeoStreamH
  57.  
  58. const OSType    kNeoScrapStreamID        = 'scrp';
  59.  
  60. class CNeoScrapStream : public CNeoStream
  61. {
  62. public:
  63.                         /** Instance Methods **/
  64.                         CNeoScrapStream(const OSType aType);
  65.                         ~CNeoScrapStream(void);
  66.  
  67.                         /** Access Methods **/
  68.     virtual void        flush(void);
  69.     virtual OSType        getStreamType(void) const {return kNeoScrapStreamID;}
  70.     virtual OSType        getType(void) const {return fType;}
  71.     virtual void        setType(const OSType aType) {fType = aType;}
  72.  
  73.                         /** I/O Methods **/
  74.     virtual NeoBlob        readBlob(const NeoMark aMark, long &aLength, const NeoTag aTag = kNeoNoTag);
  75.     virtual void        readChunk(void *aBuffer, const long aLength, const NeoTag aTag = kNeoNoTag);
  76.     virtual void        readObject(CNeoPersist *aObject, const NeoTag aTag = kNeoNoTag);
  77.  
  78.     virtual void        writeBlob(NeoBlob aBlob, const NeoMark aMark, const long aLength, const NeoTag aTag = kNeoNoTag);
  79.     virtual void        writeChunk(const void *aBuffer, const long aLength, const NeoTag aTag = kNeoNoTag);
  80.     virtual void        writeObject(CNeoPersist *aObject, const NeoTag aTag = kNeoNoTag);
  81.  
  82. protected:
  83.     long                fOffset;        // Offset into the memory block
  84.     Handle                fData;            // Handle to scrap data
  85.     OSType                fType;            // The type of scrap
  86. };
  87.  
  88. #endif